home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / vgakit41 / sticks.c < prev    next >
Text File  |  1991-10-02  |  916b  |  65 lines

  1. /*
  2.     VGAKIT Version 4.1
  3.  
  4.     Copyright 1988,89,90,91 John Bridges
  5.     Free for use in commercial, shareware or freeware applications
  6.  
  7.     STICKS.C
  8. */
  9.  
  10.  
  11. extern int maxx,maxy;
  12.  
  13. extern void bline(int x1,int y1,int x2,int y2,int color,void (*func)());
  14. extern void xpoint(),xpoint13x();
  15.  
  16. main(argc,argv)
  17. int argc;
  18. char **argv;
  19. {
  20.     unsigned char palbuf[256][3];
  21.     int svga;
  22.     unsigned int color;
  23.     unsigned int x,y,mx;
  24.     void (*func)();
  25.  
  26.     for(x=0;x<256;x++)
  27.     {
  28.         y=x&63;
  29.         if(x&64) y=63-y;
  30.         palbuf[x][0]=y;
  31.         palbuf[x][1]=y*y/63;
  32.         y=(x>>1)&63;
  33.         if(x&128) y=63-y;
  34.         palbuf[x][2]=y;
  35.     }
  36.     svga=whichvga();    
  37.     if(svga)
  38.     {
  39.         svgamode();
  40.         func=xpoint;
  41.     }
  42.     else
  43.     {
  44.         mode13x();
  45.         func=xpoint13x;
  46.     }
  47.     setmany(palbuf,0,256);
  48.     if(maxx>maxy)
  49.         mx=maxx;
  50.     else
  51.         mx=maxy;
  52.  
  53.     for(x=0;x<mx;x++)
  54.     {
  55.         for(y=0;y<mx;y++)
  56.         {
  57.             bline(x,y,y,x,y&0xff,func);
  58.         }
  59.     }
  60.     getch();
  61.     txtmode();
  62. }
  63.  
  64.  
  65.